package com.sample.transaction.atomikos.common.entity;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@MappedSuperclass
@EntityListeners({AuditingEntityListener.class})
public class BaseEntity implements Serializable {

    @CreatedBy
    @Column(name="create_by", updatable=false)
    private String createBy;

    @CreatedDate
    @Column(name="create_time", updatable=false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;

    @LastModifiedBy
    @Column(name="last_modify_by")
    private String lastModifyBy;

    @LastModifiedDate
    @Column(name="last_modify_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastModifyTime;

    @Column(name="delete_flag")
    private String deleteFlag;

}
